﻿using Microsoft.Practices.Prism.Modularity;
using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Unity;

namespace UI.Module.Menu
{
    [Module(ModuleName = "Navigator")]
    public class MenubarModule : IModule
    {
        private readonly IUnityContainer _container;

        public MenubarModule(IUnityContainer container)
        {
            _container = container;
        }
        
        public void Initialize()
        {
            this.RegisterViewsAndServices();

            var navigatorView = new MenuView();
            navigatorView.DataContext = _container.Resolve<object>();
            var regionManager = _container.Resolve<IRegionManager>();
            regionManager.Regions["NavigatorRegion"].Add(navigatorView);
        }
        private void RegisterViewsAndServices()
        {
            _container.RegisterType<object, MenuViewModel>();
        }
    }
}
